package me.chanjar.weixin.component.bean.author;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * 使用授权码换取公众号或小程序的接口调用凭据和授权信息
 * 
 * @author Debenson
 * @since 0.1
 */
public class WxApiQueryAuthResult implements Serializable {
  private static final long serialVersionUID = 3704666413372050231L;

  @JsonProperty("authorization_info")
  private WxAuthorizationInfo authorizationInfo;

  public WxAuthorizationInfo getAuthorizationInfo() {
    return authorizationInfo;
  }

  public void setAuthorizationInfo(WxAuthorizationInfo authorizationInfo) {
    this.authorizationInfo = authorizationInfo;
  }

  /**
   * @author Debenson
   * @since 0.1
   */
  public static class WxAuthorizationInfo implements Serializable {
    private static final long serialVersionUID = -6637835769294091493L;

    /** 授权方appid */
    @JsonProperty("authorizer_appid")
    private String authorizerAppid;

    /** 授权方接口调用凭据（在授权的公众号或小程序具备API权限时，才有此返回值），也简称为令牌 */
    @JsonProperty("authorizer_access_token")
    private String authorizerAccessToken;

    /** 有效期（在授权的公众号或小程序具备API权限时，才有此返回值） */
    @JsonProperty("expires_in")
    private Integer expiresIn;

    /**
     * 接口调用凭据刷新令牌（在授权的公众号具备API权限时，才有此返回值），刷新令牌主要用于第三方平台获取和刷新已授权用户的access_token，只会在授权时刻提供，请妥善保存。
     * 一旦丢失，只能让用户重新授权，才能再次拿到新的刷新令牌
     */
    @JsonProperty("authorizer_refresh_token")
    private String authorizerRefreshToken;

    /** 公众号授权给开发者的权限集列表 */
    @JsonProperty("func_info")
    private List<WxFuncInfo> funcInfo;

    public String getAuthorizerAppid() {
      return authorizerAppid;
    }

    public void setAuthorizerAppid(String authorizerAppid) {
      this.authorizerAppid = authorizerAppid;
    }

    public String getAuthorizerAccessToken() {
      return authorizerAccessToken;
    }

    public void setAuthorizerAccessToken(String authorizerAccessToken) {
      this.authorizerAccessToken = authorizerAccessToken;
    }

    public Integer getExpiresIn() {
      return expiresIn;
    }

    public void setExpiresIn(Integer expiresIn) {
      this.expiresIn = expiresIn;
    }

    public String getAuthorizerRefreshToken() {
      return authorizerRefreshToken;
    }

    public void setAuthorizerRefreshToken(String authorizerRefreshToken) {
      this.authorizerRefreshToken = authorizerRefreshToken;
    }

    public List<WxFuncInfo> getFuncInfo() {
      return funcInfo;
    }

    public void setFuncInfo(List<WxFuncInfo> funcInfo) {
      this.funcInfo = funcInfo;
    }

  }
}
